package com.stone.sys.pojo;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 * TUser entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "SYS_USER")
public class TUser120402 implements java.io.Serializable {

    // Fields

    private Long id;

    private String loginId;

    private String name;

    private String password;

    private String tel;

    private String mobile;

    private String email;

    private String state;

    private String notes;
    
    private String isadmin;

    /**
     * 排序号
     */
    private Integer sortid;
    
//    private Long organId;
    private String userCode;
    private TOrgan organ;
    
//    private Set<TRole> role = new HashSet<TRole>();

        
    @Id
    @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="SEQ_SYS_USER")
    @SequenceGenerator(name="SEQ_SYS_USER",allocationSize=1, sequenceName="SEQ_SYS_USER")
    public Long getId() {
        return this.id;
    }

    public void setId(Long id) {
        this.id = id;
    }

	@Column(name = "LOGIN_ID")
    public String getLoginId() {
        return this.loginId;
    }

    public void setLoginId(String loginId) {
        this.loginId = loginId;
    }

    public String getName() {
        return this.name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPassword() {
        return this.password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getTel() {
        return this.tel;
    }

    public void setTel(String tel) {
        this.tel = tel;
    }

    public String getMobile() {
        return this.mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
        
    }

    public String getEmail() {
        return this.email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getState() {
        return this.state;
    }

    public void setState(String state) {
        this.state = state;
    }

    public String getNotes() {
        return this.notes;
    }

    public void setNotes(String notes) {
        this.notes = notes;
    }

	public String getIsadmin() {
		return isadmin;
	}

	public void setIsadmin(String isadmin) {
		this.isadmin = isadmin;
	}

//	@Column(name = "ORGAN_ID")
//	public Long getOrganId() {
//		return organId;
//	}
//
//	public void setOrganId(Long organId) {
//		this.organId = organId;
//	}

	
    @ManyToOne(fetch =FetchType.LAZY)
    @JoinColumn(name = "ORGAN_ID")
	public TOrgan getOrgan() {
		return organ;
	}

	public void setOrgan(TOrgan organ) {
		this.organ = organ;
	}
	
	
//	@ManyToMany(
//			  targetEntity=TRole.class
//			         //cascade={CascadeType.ALL}//想用主表控制次表，必须写all
//			 )
//			 @JoinTable( name="SYS_USER_ROLE",//中间表名
//			 joinColumns=@JoinColumn(name="ID"),//列名LEADER_ID
//			  inverseJoinColumns=@JoinColumn(name="USER_ID")//列名EMPEE_I
//			  )
			  
//    @ManyToMany(fetch = FetchType.LAZY)
//    @JoinTable(name = "SYS_USER_ROLE", joinColumns =  {
//        @JoinColumn(name = "USER_ID")
//    }
//    , inverseJoinColumns =  {
//        @JoinColumn(name = "ROLE_ID")
//    }
//    )
//	public Set<TRole> getRole() {
//		return role;
//	}
//
//	public void setRole(Set<TRole> role) {
//		this.role = role;
//	}

	@Column(name = "USER_CODE")
	public String getUserCode() {
		return userCode;
	}

	public void setUserCode(String userCode) {
		this.userCode = userCode;
	}

	public Integer getSortid() {
		return sortid;
	}

	public void setSortid(Integer sortid) {
		this.sortid = sortid;
	}

}